package com.crm.sys.tab;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;

import org.apache.commons.lang.StringUtils;
import org.springframework.web.servlet.tags.RequestContextAwareTag;

public class LogStateTag extends RequestContextAwareTag   {

	private static final long serialVersionUID = 8379568609966230717L;
	
	private String value;
	
	public void setValue(String value) {
		this.value = value;
	}
	
	public LogStateTag(){  
		// System.out.println("MyTag构造方法：一个myTag类的对象被构建了....");  
	}
	
	public int doAfterBody() throws JspException{  
		// System.out.println("处理标签体（after body）....");  
		return SKIP_BODY;  
	}  
	public int doEndTag() throws JspException{  
		//  System.out.println("对象正在处理结束标记.....");  
		return EVAL_PAGE;  
	}

	@Override
	protected int doStartTagInternal() throws Exception {
		JspWriter out = this.pageContext.getOut(); 
		
		try {  
			try{
				if (StringUtils.isNotEmpty(value)){
					switch (Integer.parseInt(value)) {
					case 0:
						out.print("获取");
						break;
					case 1:
						out.print("放弃");
						break;
					case 2:
						out.print("录入");
						break;
					case 3:
						out.print("修改");
						break;
					case 4:
						out.print("索要");
						break;
					case 5:
						out.print("分配");
						break;
					default:
						out.print("");
						break;
					}
				} else {
					out.print("");
				}
			}catch(Exception e1){
				out.print("");  
			}
		} catch (IOException e) {  
			//e.printStackTrace();  
		}
		return EVAL_BODY_INCLUDE;  
	}



}
